#include <stdio.h>
#include <conio.h>
#define ff fflush(stdin);
struct fieldinfo
{
char *fieldname;
};
typedef struct table
{
char empname[20];
int no_of_fields;
struct fieldinfo fields[20];
}node;
void main()
{
node employ;
int i, choice;
FILE *ptr1;
do
{
ptr1=fopen("personal details.txt","a+");
printf("\nenter the full name of the employee.\n");
scanf("%s",employ.empname);
ff;
fprintf(ptr1,"%-30s\t",employ.empname);
printf("\nenter the no of fields, not more than 20.\n");
scanf("%10d",&employ.no_of_fields);
ff;
fprintf(ptr1,"%d\t",employ.no_of_fields);

for(i=1;i<=employ.no_of_fields;i++)
{
printf("\nenter: fieldname%d<space>detail<;>",i);
gets(employ.fields[i].fieldname);
ff;
fprintf(ptr1,"%s ",employ.fields[i].fieldname);
}
fprintf(ptr1,"\n");
fclose(ptr1);
printf("to enter more records press 1 else press 0.");
scanf("%d",&choice);
}while(choice);
clrscr();
}
